//
//  KKTopSelectView.m
//  DoMi
//
//  Created by 康凯 on 2016/11/13.
//  Copyright © 2016年 kk. All rights reserved.
//

#import "KKTopSelectView.h"

@implementation KKTopSelectView

-(void)drawRect:(CGRect)rect{
    self.frame=CGRectMake(0, 0, screenWidth, 35);
}

-(void)initData:(NSArray *)titles{
    self.firstBtn.selected=YES;
    [self.firstBtn setTitle:titles[0] forState:UIControlStateNormal];
    [self.firstBtn setTitle:titles[0] forState:UIControlStateSelected];
    [self.secondBtn setTitle:titles[1] forState:UIControlStateNormal];
    [self.secondBtn setTitle:titles[1] forState:UIControlStateSelected];
}

- (IBAction)firstClick:(id)sender {
    self.firstBtn.selected=YES;
    self.secondBtn.selected=NO;
    self.selectBlock(0);
}
- (IBAction)secondClick:(id)sender {
    self.firstBtn.selected=NO;
    self.secondBtn.selected=YES;
    self.selectBlock(1);
}

@end
